<?php
/**
 * @file index.php
 * @package 
 * @subpackage 
 * @version $id: 0.1 UTF-8 2009-5-26 下午11:15:27 $
 * @author LD King (mifunny.info)
 * @copyright Copyright (c) 2007 - 2009 MiFunny China Inc. (http://mifunny.info)
 * create table donghua(id INTEGER PRIMARY KEY AUTOINCREMENT,abc,efg);
 * 无聊的话再写一个
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>小时候的动画片[知音标题版]  @@ zhi yin ban dong hua pian  </title>

<script type="text/javascript" src="http://localhost/api/jquery.js"></script>
<style type="text/css">q {display: none;}</style> 
</head>
<body>
<?php 
$sqlite_dsn = 'sqlite:'.dirname(__FILE__).'/abc.db';
try {
	$sqlite_dbh = new PDO($sqlite_dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
	echo "SQLite PDO 连接成功<br/>";
	$sqlite_dbh->query('PRAGMA encoding = "UTF-8"');
	$sqlite_dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch (Exception $ex) {
	die ("SQLite Connent Error!: " . $ex->getMessage() . "<br/>");
}

$sqlSelect = "Select id,abc,efg from donghua";
$result = $sqlite_dbh->query($sqlSelect);
$rows = $result->fetchAll(PDO::FETCH_BOTH);
if (empty($rows[0])){ exit('<div class="box error">数据取得为空！</div>');}

?>
<ol style="list-style-type: decimal;">

<?php 
for ($i=0; $i<count($rows); $i++) {
	$str = '<li>'.$rows[$i]['abc'].'<br/><q>'.$rows[$i]['efg'].'</q></li><br />';
	if ($i%5 == 0) echo '<br /><br />';
	echo $str;
}
//var_dump($rows);
$sqlite_dbh = null;
?>
</ol>


<div id="switcher-hidden" style="width:70px;text-align:center;margin:10px;padding:10px;background-color:#fff;border-top:3px solid #888; border-left:3px solid #888;border-bottom:3px solid #444;border-right:3px solid #444;"><span>显示答案</span></div>
<script type="text/javascript">
$(document).ready(function(){$('#switcher-hidden').hover(function(){ $(this).css({cursor:"pointer",background:"#afa"});
	}, function(){ $(this).css({cursor:"none",background:"#fff"});});
$('q').css("color","blue");
$('#switcher-hidden').toggle(function(){ $("q").show("slow"); $("#switcher-hidden span").replaceWith('<span>隐藏答案</span>');
	}, function(){ $("q").hide("slow"); $("#switcher-hidden span").replaceWith('<span>显示答案</span>'); });
});</script>



<div style="text-align:center;margin:75px 0 25px 0;position:relative;">
	<p>Copyright &copy; 2008 - 2009, <a href="http://mifunny.info/">水草树</a>, All right reserved.</p>
	<p><a href="index.php">首页</a> | <a href="sqlite3.php">录入数据</a></p>
</div>
</body>
</html>